<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title>Demo1</title>

    <style type="text/css">
        .demo1 {
            height: 150px;
        }
    </style>

</head>

<body>
    <div style="height:200px;"></div>
    <div class="demo1">
        方本框：<input type="text" id="J-xl" placeholder="请输入创建项目日期">
    </div>

    <div class="demo1">
        按钮触发：<input type="text" id="J-xl-2"><input type="button" id="J-xl-2-btn" value="打开">
    </div>

    <div class="demo1">
        <label for="J-xl-3">Label触发：</label><input type="text" id="J-xl-3">
    </div>

    <div class="demo1">
        直接传dom：<input type="text" id="J-xl-4">
    </div>

    <script type="text/javascript" src="laydate.dev.js"></script>
    <script type="text/javascript">
        laydate({
            elem: '#J-xl',
            choose: function () {
                console.log(111111111);
            },
        });
        document.getElementById('J-xl-2-btn').onclick = function () {
            laydate({
                elem: '#J-xl-2',
                min: minDate()
            });
        }

        function minDate() {
            var now = new Date();
            return now.getFullYear() + "-" + (now.getMonth() + 1) + "-" + (now.getDate() + 1);
        }

        laydate({
            elem: '#J-xl-3',
            format: 'YYYYMMDD', //修改日期格式
        });



        laydate({
            elem: document.getElementById('J-xl-4')
        });

        var start = "2018-10-17 17:02";
        var start_time = start.replace(/-|\s|:|\//g, '');
        console.log(start_time);
    </script>

</body>

</html>